<template>
	<view class="container">
		<view class="header" @click="$goURl('/pages/personal/address/list?typeStr=1&takeout=1')" v-if="!data.type">
			<view class="left" v-if="JSON.stringify(address)!='{}'">
				<view class="address">
					<uni-tag text="默认" v-if="address.is_default==1"
						custom-style="background-color: #0bc4e3; border-color: #0bc4e3; color: #fff; margin-right:20upx;"
						type="primary" />
					{{address.name}} {{address.mobile}}
				</view>
				<view class="addressxx">
					{{address.province}}{{address.city}}{{address.area}}{{address.detailed}}

				</view>
			</view>
			<view class="left" v-else>
				<view class="addressxx">
					请选择地址
				</view>
			</view>
			<uni-icons type="forward" size="30"></uni-icons>
		</view>
		<view class="position">
			<view class="position-text">
				<view class="left">
					<view class="">{{data.title}}</view>
					<view class="botm">
						<view class="lefts">{{data.address}}</view>
						<!-- <view class="">554m</view> -->
					</view>
				</view>
				<view class="right" @click="lookmap">
					<image src="https://pili-vod.guanxikeji.com/xiaotubiao/img/1731305762419.png"></image>
				</view>
			</view>
		</view>
		<view class="box">
			<view class="itemize">
				<scroll-view class="bg" scroll-y="true" :scroll-with-animation="true" style="height: calc(100vh - 60px);">
					<block v-for="(item,index) in data.shoplist" :key="index">
						<view class="itemize-item" :class="{'ac':data.active == index}" @click="changeNav(item,index)">
							<view class="itemize-img-box">
								<view class="itemize-img-wrap">
									<image :src="item.default_image"></image>
								</view>
								<text>{{item.name}}</text>
							</view>
							<!-- <text>{{item.name}}</text> -->
						</view>
					</block>
				</scroll-view>
			</view>
			<view class="right-goods">
				<scroll-view scroll-y="true" style="height: calc(100vh - 150px);">
					<view class="goods-item" v-for="(item,index) in data.list" :key="index">
						<view class="goods">
							<image class="goods-img" :src="item.default_image" mode="aspectFit">
							</image>
							<view class="goods-info">
								<view class="goods-info-title">{{item.name}}</view>
								<view class="goods-info-price Al_Bold">
									{{item.price }}
								</view>
								<view class="goods-info-btn-save">￥{{item.salePrice}} zkfc: {{$toFiexd((item.price-item.salePrice),2)}}
								</view>
								<view class="goods-info-btn">
									<view class="goods-info-btn-other">
									</view>
									<view class="goods-info-btn-select" @click="openmen(item)">选规格</view>
								</view>
							</view>
						</view>
					</view>

				</scroll-view>
			</view>
		</view>
		<view class="bootm" v-if="data.payfalg && data.paylist.length>0">
			<view class="fixed-menu">
				<view class="fixed-menu-price">
					<uni-badge :text="data.cardtatal" absolute="rightTop" size="normal">
						<view class="fixed-menu-price-img" @click="lookcard">
							<image src="https://pili-vod.guanxikeji.com/hemashangcheng/img/1730973181874.png"></image>
						</view>
					</uni-badge>
					<view class="fixed-menu-money">
						<view class="Al_Bold">
							<view class="fixed-menu-money-font1">
								{{data.tatolmoney}}
								<text></text>
							</view>
							<view class="mingInfo" v-if="data.deliveryPrice>0">
								<view style="color: rgb(209, 33, 40);">配送费:￥{{data.deliveryPrice}}</view>
							</view>
						</view>
						<view class="other-tips">￥{{data.tatolamount}}+ zkfc:{{data.zkfc}}</view>
					</view>
				</view>
				<view class="fixed-menu-pay" @click="gopay">去结算</view>
			</view>
		</view>
		<uni-popup ref="popup" type="bottom" border-radius="10px 10px 0 0" @maskClick="handleMaskClicks">
			<view class="product-bpx">
				<view class="product-info">
					<view class="info-name">
						<view class="name">{{data.detail.name}}</view>
					<!-- 	<view class="number Al_Medium">
							<view class="delete" @click="delbox()"></view>
							<view>{{data.number}}</view>
							<view class="add" @click="addbox()"></view>
						</view> -->
					</view>
					<!-- <view class="info-tips">
						详情描述:
						<text>
							{{data.detail.selective}}
						</text>
					</view> -->
				</view>
				<scroll-view class="" scroll-y="true" :scroll-with-animation="true" style="height: calc(500px - 60px);">
					<view class="sku-box">
						<view>
							<view class="sku-wrap" v-for="(item,index) in data.detail.goods" :key="index">
								<view class="sku-title">{{item.name}}</view>
								<view class=" " style="margin-top: 5px;">
									<view v-if="item.display_type == 'bar'">
										<view v-for="(it,i) in item.extra_list" :key="i">
											<view class="item_extra"
												style="display: flex;align-items: center; justify-content: space-between; margin-top: 5px; ">
												<view style="color: #fff;">{{it.name}}</view>
												<view class="allcenter">
													<image @click="delextra(it,index,i)"
														src="https://pili-vod.guanxikeji.com/hemashangcheng/img/1732589496546.png"></image>
													<view style="color: #fff; padding: 0 5px;">{{it.is_default}}</view>
													<image @click="addextra(it,index,i)"
														src="https://pili-vod.guanxikeji.com/hemashangcheng/img/1732589502481.png"></image>
												</view>

											</view>
										</view>
									</view>
									<view v-else-if="item.display_type == 'checkbox' || (item.display_type == 'text' && item.name == '换茶底')  ">
										<uni-data-checkbox mode="tag" multiple  v-model="item.checkbox"
											@change="checkboxChange($event,item,index)" :localdata="item.checklist"></uni-data-checkbox>
									</view>
									<uni-data-checkbox mode="tag" v-else v-model="item.checkbox"
										@change="checkboxChange($event,item,index)" :localdata="item.checklist"></uni-data-checkbox>
								</view>
							</view>
						</view>
						<view class="illustrate-box">
							<view class="illustrate-title">说明</view>
							<view class="illustrate">{{data.detail.product_des || '无'}}</view>
						</view>
					</view>

				</scroll-view>
				<view class="product-bth-box">
					<view class="product-bth">
						<view class="product-price">
							<view class="after-price">
								¥ <text>{{data.detail.price}}</text>
							</view>
							<view class="before-price">
								<view>¥ {{data.detail.amount}}</view>
								<view>zkfc : {{$toFiexd((data.detail.price-data.detail.amount),2)}}</view>
							</view>
						</view>
						<view class="btn-text" @click="addcard">加入购物车</view>
					</view>
				</view>
			</view>

		</uni-popup>
		<uni-popup ref="cardlist" type="bottom" border-radius="10px 10px 0 0">
			<view class="Shopping-Cart">
				<view class="cart-head" @click="delpaylisy">
					<image src="https://pili-vod.guanxikeji.com/hemashangcheng/img/1731046873366.png"></image>
					清空购物车
				</view>
				<view class="cart-item-wrap">
					<scroll-view class="" scroll-y="true" :scroll-with-animation="true" style="height: calc(400px);">
						<view class="cart-item" v-for="(it,i) in data.paylist" :key="i">
							<image :src="it.default_image"></image>
							<view class="cart-item-box">
								<view class="item-box-title">{{it.name}}</view>
								<view class="item-box-tips-box" v-for="(item,index) in it.condimentRoundList">
									<view class="item-box-tips2" v-for="(ite,ine) in item.condimentItemList" :key="ine">
										<view v-if="ite.checked || item.checked"> {{ite.quantity}} x
											{{ite.showNameCn}}
										</view>
									</view>
								</view>
								<view class="item-box-bottom">
									<view class="price">
										<text>¥</text>
										{{it.price}}
										<view class="Al_Medium"> <text>¥</text> {{it.amount}} + zkfc:{{$toFiexd((it.price-it.amount),2) }}
										</view>
										<!-- <text class="Al_Medium">￥{{it.amount}} + zkfc:{{$toFiexd((it.price-it.amount),2) }}</text> -->
									</view>
									<view class="number Al_Medium">
										<view class="add" @click="minus(it,i)"></view>
										<view>{{it.quantity}}</view>
										<view class="delete" @click="addpaylist(it,i)"></view>
									</view>
								</view>
							</view>
						</view>
					</scroll-view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>
<script setup>
	import {
		ref,
		reactive,
		getCurrentInstance
	} from "vue";
	import {
		onLoad,
		onShow,
		onUnload
	} from "@dcloudio/uni-app";
	const {
		proxy
	} = getCurrentInstance();
	let popup = ref()
	let cardlist = ref()
	let checkbox1 = ref()
	let address = ref({
		id: ''
	})
	let data = reactive({
		active: 0,
		shoplist: [],
		list: [],
		store_code: '',
		lng: '',
		lat: '',
		title: "",
		address: "",
		detail: {},
		paylist: [],
		payfalg: false,
		payobj: [],
		tatolmoney: 0,
		tatolamount: 0,
		zkfc: 0,
		selectlist: [], //选择的
		number: 1,
		order_type: 1, //类型
		type: '',
		merdetails: {},
		deliveryPrice: 0,

	})
	onLoad((opt) => {
		if (opt.id) {
			data.store_code = opt.id
			data.lng = parseFloat(opt.lng)
			data.lat = parseFloat(opt.lat)
			getGoods() // 获取门店
		}
		let type = uni.getStorageSync('starbuckstype') //判断是外卖还是堂食
		data.type = uni.getStorageSync('starbuckstype') //判断是外卖还是堂食
		if (type) {
			data.order_type = 1
		} else {
			data.order_type = 2
			getAddress()
		}
	})
	onShow(() => {
		//判断是否支付成功返回
		let flag = uni.getStorageSync('paysuccess')
		if (flag) {
			uni.removeStorageSync('paysuccess');
			data.paylist = []
		}
		uni.$on('selectAddress', (info) => { //开启监听全局的地址改变事件
			address.value = info
			data.payobj.address_id = info.id
			address.value.id = info.id
			try {
				data.lng = info.longitude
				data.lat = info.latitude
				getGoods()
			} catch (e) {
				data.merdetails = uni.getStorageSync('merdetails');
				data.lng = data.merdetails.lng
				data.lat = data.merdetails.lat
			}
			uni.$off('selectAddress');
		})

	})
	onUnload(() => {
		uni.$off('selectAddress') //在此生命周期里销毁地址改变事件的监听

	})
	//获取地址
	function getAddress() {
		proxy.$request({
			url: `api/address/?page=1&size=20&is_default=1`,
			method: 'get',
			success: (res) => {
				if (res.data.ID) {
					address.value = res.data
					address.value['id'] = res.data.ID
					data.lng = res.data.longitude
					data.lat = res.data.latitude
					getGoods() // 获取门店
				} else {
					address.value = {}
					uni.showToast({
						icon: 'none',
						title: "请先添加地址"
					})

				}
			}
		})
	}
	//购物车弹窗
	function handleMaskClicks() {
		if (data.paylist.length > 0) {
			data.payfalg = true
		}
	}
	//规格数量 ++--
	function delbox() {
		if (data.number !== 1) {
			data.number--
		}
		data.detail.amount = (data.detail.amount * data.number).toFixed(2)
		data.detail.price = (data.detail.amount * data.number).toFixed(2)
	}

	function addbox() {
		data.number++
		data.detail.amount = (data.detail.amount * data.number).toFixed(2)
		data.detail.price = (data.detail.price * data.number).toFixed(2)
	}
	//清空购物车
	function delpaylisy() {
		data.paylist = []
		cardlist.value.close()
	}

	//单选
	function checkboxChange(e, row, i) {
		data.number = 1
		//先判断是否选了杯型和温度
		if (row.code == 'Cupsize') {
			let selcoffearr = data.detail.selcoffe.split("_")
			selcoffearr[0] = e.detail.data.attribute
			data.detail.selcoffe = selcoffearr.join("_")
			data.detail.coffeelist.forEach((item) => {
				if (item.key == data.detail.selcoffe) {
					data.detail.sku_id = item.sku_id
					data.detail.amount = item.salePrice
					data.detail.oldamount = item.salePrice
					data.detail.price = item.price
					data.detail.oldprice = item.price
				}
			})
			let newrules = []
			data.detail.rules.forEach((it) => {
				if (it.code == data.detail.sku_id) {
					newrules = it.rules
				}
			})
			let arr = []

			newrules.forEach(((items) => {
				let obj = JSON.parse(JSON.stringify(items))
				data.detail.customizations.forEach((item) => {
					if (item.extra_list.length > 0) {
						if (items.group_code == item.code) {
							obj.extra_list = []
							items.group_detail_rules.forEach((ites, index) => {
								item.extra_list.forEach((ite) => {
									if (ites.group_detail_code == ite.code) {
										ite.free_number = ites.free_number
										ite.rule_number = ites.rule_number
										ite.price_times = ites.price_times
										ite.display_type = ites.display_type
										if(ites.name == '浓缩份数'){
												ite.is_default = ites.default_count
												ite.default_count = ites.default_count
										}else{
											if (ites.is_default > 0) {
												ite.is_default = ites.default_count
													ite.default_count = ites.default_count
											} else {
												ite.is_default = ites.min_number
												if(items.group_code == 'ChangeSyrup'){ //它这个不能去默认的
													ite.default_count = ites.min_number
												}else{
													ite.default_count = ites.default_count
												}
											}

										}
										ite.max_number = ites.max_number
										ite.min_number = ites.min_number
										obj.name = obj.group_name
										obj.extra_list.push(ite)
									}
								})
							})
							arr.push(obj)
						}
					}
				})

			}))

			data.detail.goodarr = arr
			data.detail.goods.forEach((item) => {
				data.detail.goodarr.forEach((items) => {
					if (item.name == items.name && items.name!=='浓缩份数') {
						if(item.extra_list.length>0){
							item.checkbox = item.extra_list[0].name
								item.extra_list.forEach((ite) => {
									items.extra_list.forEach((ites) => {
										if(ite.name == ites.name){
											ite.code = ites.code
											ite.default_count = ites.default_count
											ite.is_default = ites.is_default
											ite.free_number = ites.free_number
											ite.max_number = ites.max_number
											ite.min_number = ites.min_number
										}

									})
								})
						}else{
								uni.showToast({
									icon: 'none',
									title: "操作频繁，请重新选择"
								})
								popup.value.close()
						}

					}
				})
			})
			//因为修改了萃取 所以这里的浓缩得改
			let nscode = ""
			data.detail.goods.forEach((item) => {
				if(item.name == '萃取方式'){
					item.checkbox = item.checklist[0].text
						item.checklist.forEach((it) => {
							if(item.checkbox == it.text){
								nscode = it.code
							}
						})
				}
			})
			data.detail.goods =JSON.parse(JSON.stringify(data.detail.goods))
			data.detail.goodarr.forEach((item) => {
				if(item.group_code == nscode){
					data.detail.goods.forEach((items) => {
						if(items.name == '浓缩份数' ){
							items.code = nscode
							items.checklist[0].code = item.extra_list[0].code
							items.checklist[0].is_default = item.extra_list[0].is_default
							items.checklist[0].free_number = item.extra_list[0].free_number
							items.checklist[0].max_number = item.extra_list[0].max_number
							items.checklist[0].min_number = item.extra_list[0].min_number
							items.checklist[0].price = item.extra_list[0].price
							items.checklist[0].default_count = item.extra_list[0].default_count

							items.extra_list[0].code = item.extra_list[0].code
							items.extra_list[0].is_default = item.extra_list[0].is_default
							items.extra_list[0].free_number = item.extra_list[0].free_number
							items.extra_list[0].max_number = item.extra_list[0].max_number
							items.extra_list[0].min_number = item.extra_list[0].min_number
							items.extra_list[0].price = item.extra_list[0].price
							items.extra_list[0].default_count = item.extra_list[0].default_count

						}
					})
				}
			})

		} else if (row.code == 'Temperature') {
			let selcoffearr = data.detail.selcoffe.split("_")
			selcoffearr[1] = e.detail.data.attribute
			data.detail.selcoffe = selcoffearr.join("_")
			data.detail.coffeelist.forEach((item) => {
				if (item.key == data.detail.selcoffe) {
					data.detail.sku_id = item.sku_id
					data.detail.amount = item.salePrice
					data.detail.oldamount = item.salePrice
					data.detail.price = item.price
					data.detail.oldprice = item.price
				}
			})
			let newrules = []
			data.detail.rules.forEach((it) => {
				if (it.code == data.detail.sku_id) {
					newrules = it.rules
				}
			})
			let arr = []
			newrules.forEach(((items) => {
				let obj = JSON.parse(JSON.stringify(items))
				data.detail.customizations.forEach((item) => {
					if (item.extra_list.length > 0) {
						if (items.group_code == item.code) {
							obj.extra_list = []
							items.group_detail_rules.forEach((ites, index) => {
								item.extra_list.forEach((ite) => {
									if (ites.group_detail_code == ite.code) {
										ite.free_number = ites.free_number
										ite.rule_number = ites.rule_number
										ite.price_times = ites.price_times
										ite.display_type = ites.display_type
									if(ites.name == '浓缩份数'){
											ite.is_default = ites.default_count
											ite.default_count = ites.default_count
									}else{
										if (ites.is_default > 0) {
											ite.is_default = ites.default_count
												ite.default_count = ites.default_count
										} else {
											ite.is_default = ites.min_number
											if(items.group_code == 'ChangeSyrup'){ //它这个不能去默认的
												ite.default_count = ites.min_number
											}else{
												ite.default_count = ites.default_count
											}
										}

									}
										ite.max_number = ites.max_number
										ite.min_number = ites.min_number
										obj.name = obj.group_name
										obj.extra_list.push(ite)
									}
								})
							})
							arr.push(obj)
						}
					}
				})

			}))
			data.detail.goodarr = arr
			data.detail.goods.forEach((item) => {
				data.detail.goodarr.forEach((items) => {
					if (item.name == items.name && items.name!=='浓缩份数') {
						if(item.extra_list.length>0){
							item.checkbox = item.extra_list[0].name
							item.extra_list.forEach((ite) => {
								items.extra_list.forEach((ites) => {
									if(ite.name == ites.name){
										ite.code = ites.code
										ite.default_count = ites.default_count
										ite.is_default = ites.is_default
										ite.free_number = ites.free_number
										ite.max_number = ites.max_number
										ite.min_number = ites.min_number
										ite.rule_number = ites.rule_number
										ite.price_times = ites.price_times
									}
								})
							})
						}else{
							uni.showToast({
								icon: 'none',
								title: "操作频繁，请重新选择"
							})
							popup.value.close()
						}

					}
				})
			})
			//因为修改了萃取 所以这里的浓缩得改
			let nscode = ""
			data.detail.goods.forEach((item) => {
				if(item.name == '萃取方式'){
					item.checkbox = item.checklist[0].text
						item.checklist.forEach((it) => {
							if(item.checkbox == it.text){
								nscode = it.code
							}
						})
				}
			})
			data.detail.goods =JSON.parse(JSON.stringify(data.detail.goods))
			data.detail.goodarr.forEach((item) => {
				if(item.group_code == nscode){
					data.detail.goods.forEach((items) => {
						if(items.name == '浓缩份数'){
							items.code = nscode
							items.checklist[0].code = item.extra_list[0].code
							items.checklist[0].is_default = item.extra_list[0].is_default
							items.checklist[0].free_number = item.extra_list[0].free_number
							items.checklist[0].max_number = item.extra_list[0].max_number
							items.checklist[0].min_number = item.extra_list[0].min_number
							items.checklist[0].price = item.extra_list[0].price
							items.checklist[0].default_count = item.extra_list[0].default_count

							items.extra_list[0].code = item.extra_list[0].code
							items.extra_list[0].is_default = item.extra_list[0].is_default
							items.extra_list[0].free_number = item.extra_list[0].free_number
							items.extra_list[0].max_number = item.extra_list[0].max_number
							items.extra_list[0].min_number = item.extra_list[0].min_number
							items.extra_list[0].price = item.extra_list[0].price
							items.extra_list[0].default_count = item.extra_list[0].default_count
							items.extra_list[0].rule_number = item.extra_list[0].rule_number
							items.extra_list[0].price_times = item.extra_list[0].price_times
						}
					})
				}
			})

		}else if(row.name == '萃取方式'){
			//萃取方式 的选择决定浓缩分数的code和id
			row.checklist.forEach((it) => {
				if(row.checkbox == it.text){
					row.code = it.code
				}
			})
			 //萃取方式的修改会让价格发生改变
			 let newrules = []
			 data.detail.rules.forEach((it) => {
			 	if (it.code == data.detail.sku_id) {
			 		newrules = it.rules
			 	}
			 })
			 let arr = []
			 newrules.forEach(((items) => {
			 	let obj = JSON.parse(JSON.stringify(items))
			 	data.detail.customizations.forEach((item) => {
			 		if (item.extra_list.length > 0) {
			 			if (items.group_code == item.code) {
			 				obj.extra_list = []
			 				items.group_detail_rules.forEach((ites, index) => {
			 					item.extra_list.forEach((ite) => {
			 						if (ites.group_detail_code == ite.code) {
			 							ite.free_number = ites.free_number
			 							ite.rule_number = ites.rule_number
			 							ite.price_times = ites.price_times
										ite.display_type = ites.display_type
											if(ites.name == '浓缩份数'){
													ite.is_default = ites.default_count
													ite.default_count = ites.default_count
											}else{
												if (ites.is_default > 0) {
													ite.is_default = ites.default_count
														ite.default_count = ites.default_count
												} else {
													ite.is_default = ites.min_number
													if(items.group_code == 'ChangeSyrup'){ //它这个不能去默认的
														ite.default_count = ites.min_number
													}else{
														ite.default_count = ites.default_count
													}
												}

											}


			 							ite.max_number = ites.max_number
			 							ite.min_number = ites.min_number
			 							obj.name = obj.group_name
			 							obj.extra_list.push(ite)
			 						}
			 					})
			 				})
			 				arr.push(obj)
			 			}
			 		}
			 	})

			 }))
			 data.detail.goodarr = arr
			 data.detail.goods.forEach((item) => {
			 	data.detail.goodarr.forEach((items) => {
			 		if (item.name == items.name && items.name!=='浓缩份数' && items.name!=='萃取方式' && items.name!=='浓缩咖啡') {
			 			item.checkbox = item.extra_list[0].name
			 			item.extra_list.forEach((ite) => {
			 				items.extra_list.forEach((ites) => {
			 					if(ite.name == ites.name){
			 						ite.code = ites.code
			 						ite.default_count = ites.default_count
			 						ite.is_default = ites.is_default
			 						ite.free_number = ites.free_number
			 						ite.max_number = ites.max_number
			 						ite.min_number = ites.min_number
			 						ite.rule_number = ites.rule_number
			 						ite.price_times = ites.price_times
			 					}
			 				})
			 			})
			 		}
			 	})
			 })
			let price = 0
			let number =0
			let newprice = 0
			let newnumber = 0
			data.detail.goods.forEach((items) => {
				data.detail.goodarr.forEach((item) => {
					if(item.group_code == row.code){
						if(items.name == '浓缩份数'){
							items.code = row.code
						price = items.extra_list[0].price
						number = items.extra_list[0].is_default
						items.checklist[0].code = item.extra_list[0].code
						items.checklist[0].is_default = item.extra_list[0].is_default
						items.checklist[0].free_number = item.extra_list[0].free_number
						items.checklist[0].max_number = item.extra_list[0].max_number
						items.checklist[0].min_number = item.extra_list[0].min_number
						items.checklist[0].price = item.extra_list[0].price

						items.extra_list[0].code = item.extra_list[0].code
						items.extra_list[0].is_default = item.extra_list[0].is_default
						items.extra_list[0].free_number = item.extra_list[0].free_number
						items.extra_list[0].max_number = item.extra_list[0].max_number
						items.extra_list[0].min_number = item.extra_list[0].min_number
						items.extra_list[0].price = item.extra_list[0].price
						items.extra_list[0].rule_number = item.extra_list[0].rule_number
						items.extra_list[0].price_times = item.extra_list[0].price_times
						newprice = item.extra_list[0].price
						newnumber = item.extra_list[0].is_default
						}
					}
				})
			})
			console.log(price,number,"旧的")
			console.log(newprice,newnumber,"新的")
			let money = newprice *newnumber - price*number
			data.detail.amount= (parseFloat(data.detail.amount) +  money).toFixed(2)
			data.detail.leachmeny =   money
			data.detail.price = (parseFloat(data.detail.price) + money).toFixed(2)
			//浓缩咖啡也会修改萃取方式和浓缩分数的值
		}else if(row.name == '浓缩咖啡'){
			//我这里强行把选了浓缩的话  萃取方式也改为默认的 不然价格不好算
			let code = ""
			row.checklist.forEach((it) => {
				if(it.text == row.checkbox){
					code = it.code
				}
			})
			data.detail.goodarr.forEach((item) => {
				if(item.group_code == code){
					data.detail.goods.forEach((items) => {
						if(items.name == '萃取方式' && item.group_name == '萃取方式'){
							items.extra_list = item.extra_list
							// items.code = item.group_code
							items.checklist.forEach((it) => {
								item.extra_list.forEach((its) => {
									if(it.text == its.name){
										it.code = its.code
									}
								})
							})
						}
					})
				}
			})
			let nscode = ""  //拿到新的浓缩code
			data.detail.goods.forEach((item) => {
				if(item.name == '萃取方式'){
					item.checkbox = item.checklist[0].text //这里强行默认试试
						item.checklist.forEach((it) => {
							if(item.checkbox == it.text){
								nscode = it.code
							}
						})
				}
			})

			let price = 0
			let number =0
			let newprice = 0
			let newnumber = 0
			data.detail.goodarr.forEach((item) => {
				if(item.group_code == nscode){
					data.detail.goods.forEach((items) => {
						if(items.name == '浓缩份数'){

							console.log(items.extra_list[0].price)
							items.code = nscode
							price = items.extra_list[0].price
							number = items.extra_list[0].is_default
							items.checklist[0].code = item.extra_list[0].code
							items.checklist[0].is_default = item.extra_list[0].is_default
							items.checklist[0].free_number = item.extra_list[0].free_number
							items.checklist[0].max_number = item.extra_list[0].max_number
							items.checklist[0].min_number = item.extra_list[0].min_number
							items.checklist[0].price = item.extra_list[0].price

							items.extra_list[0].code = item.extra_list[0].code
							items.extra_list[0].is_default = item.extra_list[0].is_default
							items.extra_list[0].free_number = item.extra_list[0].free_number
							items.extra_list[0].max_number = item.extra_list[0].max_number
							items.extra_list[0].min_number = item.extra_list[0].min_number
							items.extra_list[0].price = item.extra_list[0].price
							items.extra_list[0].rule_number = item.extra_list[0].rule_number
							items.extra_list[0].price_times = item.extra_list[0].price_times
							newprice = item.extra_list[0].price
							newnumber = item.extra_list[0].is_default
						}
					})
				}
			})
			let money = newprice *newnumber - price*number
			data.detail.amount= (parseFloat(data.detail.amount) +  money).toFixed(2)
			data.detail.leachmeny =   money
			data.detail.price = (parseFloat(data.detail.price) + money).toFixed(2)
		}
		console.log(data.detail ,"data.detail ")
	}


	//结算
	function gopay() {
		//这里处理
		console.log(data.paylist, "paylist")
		let goods = []
		data.paylist.forEach((item) => {
			let obj = {}
			item.selactive = ''
			obj.num = item.quantity
			obj.skuId = item.sku_id
			obj.productId = item.id
			obj.addExtra = []
			item.goods.forEach((ite) => {
				if (ite.display_type == 'bar') {
					ite.extra_list.forEach((it) => {

						if (it.is_default > 0) {
							item.selactive += it.name + '/'
							let newobj = {
								extra_sku: it.code,
								qty: it.is_default.toString()
							}
							obj.addExtra.push(newobj)
						}
					})
				} else {
					item.selactive += ite.checkbox + '/'
					if (ite.code !== 'Cupsize' && ite.code !== 'Temperature') {
						ite.checklist.forEach((it) => {
							if (ite.checkbox == it.value) {
								let newobj = {
									extra_sku: it.attribute || it.code,
									qty: "1"
								}
								obj.addExtra.push(newobj)
							}

						})
					} else if (ite.code == 'Temperature') {
						ite.checklist.forEach((it) => {
							if (ite.checkbox == it.value) {
								let newobj = {
									extra_sku: it.code,
									qty: "1"
								}
								obj.addExtra.push(newobj)
							}

						})
					}
				}
			})
			goods.push(obj)
		})
		console.log(goods, 'goods')

		uni.setStorageSync('goods', goods);
		uni.setStorageSync('paylist', data.paylist);
		uni.navigateTo({
			url: `/pages/Lochig/starbucks/confirmOrder?id=${data.store_code}&lng=${data.lng}&lat=${data.lat}&addressid=${address.value['id']}&deliveryPrice=${data.deliveryPrice}&title=${data.title}&address=${data.address}`
		})
	}
	//选规格
	function openmen(row) {
		console.log(data.store_code, " data.store_code")
		checkbox1.value = []
		data.number = 1
		data.detail = {}
		proxy.$request({
			url: `api/openapi/starbucks/getGoodsDetail/`,
			method: 'post',
			data: {
				product_id: row.id,
				store_code: data.store_code,
			},
			success: (res) => {
				if (res.errno == 0) {
					let arr = []
					let customizations = res.data.customization_data.customizations
					let newcustomizations = JSON.parse(JSON.stringify(res.data.customization_data.customizations))
					let newcustomizationsobj = JSON.parse(JSON.stringify(res.data.customization_data.customizations))
					customizations.forEach((it) => {
						if (it.is_fold == 0) {
							if (it.extra_list.length > 0) {
								//几个浓缩判断
								if ((it.code == 'StandardCoffeeMopFilter' || it.code == 'RistrettoStandardMopFilter' || it
										.code == 'LongshotStandardMopFilter' || it.code == 'StandardStandardMopFilter') && it
									.display_type == 'bar') {
									it.extra_list.forEach((ite, i) => {
										if (ite.is_default == 0) {
											it.extra_list.splice(i, 1)
										}
									})
									if (it.extra_list.length > 0) {
										arr.push(it)
									}

								} else {
									if (it.parent_category_code == it.parent_code) {
										it.extra_list.forEach((ite, i) => {
											if (ite.status !== 2) {
												it.extra_list.splice(i, 1)
											}
										})
										arr.push(it)

									} else {
										arr.push(it)
									}
								}

							}
						}

					})
					arr.forEach((item) => {
						if(item.display_type == 'checkbox'){
							item.checkbox =[]
							item.checklist = []
							item.extra_list.forEach((it) => {
								let valueobj = {}
								if (it.display_type == 'bar') {
									valueobj = {
										text: it.name,
										value: it.name,
										code: it.code,
										attribute: it.code
									}
								} else {
									valueobj = {
										text: it.name,
										value: it.name,
										code: it.code,
										attribute: it.attribute
									}
								}
								item.checklist.push(valueobj)
							})
						}else{
								item.checkbox = item.extra_list[0].name
								item.checklist = []
								item.extra_list.forEach((it) => {
									let valueobj = {}
									if (it.display_type == 'bar') {
										valueobj = {
											text: it.name,
											value: it.name,
											code: it.code,
											attribute: it.code
										}
									} else {
										valueobj = {
											text: it.name,
											value: it.name,
											code: it.code,
											attribute: it.attribute
										}
									}
									item.checklist.push(valueobj)
								})
						}

					})
					//初始杯型id
					let selcoffe = ""
					let Cupsize = ""
					let Temperature = ""
					arr.forEach((it) => {
						if (it.code == 'Cupsize') {
							Cupsize = it.extra_list[0].code
						}
						if (it.code == 'Temperature') {
							Temperature = it.extra_list[0].attribute
						}
					})
					selcoffe = Cupsize + '_' + Temperature
					let coffee_sku_mapping = res.data.coffee_sku_mapping
					let rules = res.data.rules
					let coffeelist = [] //温度杯型
					if (coffee_sku_mapping.Grande_Cold.key) {
						coffeelist.push(coffee_sku_mapping.Grande_Cold)
					}
					if (coffee_sku_mapping.Grande_Hot.key) {
						coffeelist.push(coffee_sku_mapping.Grande_Hot)
					}
					if (coffee_sku_mapping.Tall_Cold.key) {
						coffeelist.push(coffee_sku_mapping.Tall_Cold)
					}
					if (coffee_sku_mapping.Tall_Hot.key) {
						coffeelist.push(coffee_sku_mapping.Tall_Hot)
					}
					if (coffee_sku_mapping.Venti_Cold.key) {
						coffeelist.push(coffee_sku_mapping.Venti_Cold)
					}
					if (coffee_sku_mapping.Venti_Hot.key) {
						coffeelist.push(coffee_sku_mapping.Venti_Hot)
					}
					let sku_id = "" //找id
					let price = "" //找价格
					let salePrice = "" //找价格

					coffeelist.forEach((it) => {
						if (it.key == selcoffe) {
							sku_id = it.sku_id
							price = it.price
							salePrice = it.salePrice

						}
					})
					//再拿sku_id 找对应的rules
					let newrules = []
					let rulesarr = []

					rules.forEach((it) => {
						if (it.code == sku_id) {

							newrules = it.rules
							rulesarr = it.rules
						}
					})

					arr.forEach((item) => {
						if (item.display_type == 'bar') {
							newrules.forEach((items) => {
								if (item.code == items.group_code) {
									item.group_max_number = items.group_max_number
									item.group_min_number = items.group_min_number
									item.extra_list.forEach((ite) => {
										items.group_detail_rules.forEach((ites) => {
											if (ite.code == ites.group_detail_code) {
												ite.free_number = ites.free_number
												ite.rule_number = ites.rule_number
												ite.price_times = ites.price_times
												ite.display_type = ites.display_type
											if(ites.name == '浓缩份数'){
													ite.is_default = ites.default_count
													ite.default_count = ites.default_count
											}else{
												if (ites.is_default > 0) {
													ite.is_default = ites.default_count
														ite.default_count = ites.default_count
												} else {
													ite.is_default = ites.min_number
													if(items.group_code == 'ChangeSyrup'){ //它这个不能去默认的
														ite.default_count = ites.min_number
													}else{
														ite.default_count = ites.default_count
													}
												}

											}
												ite.max_number = ites.max_number
												ite.min_number = ites.min_number
											}

										})
									})
								}
							})
						}
					})

					//这里处理规则 下面匹配上面的  上面的是上面匹配下面的
					let newarr = []
					rulesarr.forEach((items) => {
						let obj = JSON.parse(JSON.stringify(items))
						newcustomizationsobj.forEach((item) => {
							if (item.extra_list.length > 0) {
								if (items.group_code == item.code) {
									obj.extra_list = []
									items.group_detail_rules.forEach((ites, index) => {
										item.extra_list.forEach((ite) => {
											if (ites.group_detail_code == ite.code) {
												ite.free_number = ites.free_number
												ite.rule_number = ites.rule_number
												ite.price_times = ites.price_times
												ite.display_type = ites.display_type
										if(ites.name == '浓缩份数'){
												ite.is_default = ites.default_count
												ite.default_count = ites.default_count
										}else{
											if (ites.is_default > 0) {
												ite.is_default = ites.default_count
													ite.default_count = ites.default_count
											} else {
												ite.is_default = ites.min_number
												if(items.group_code == 'ChangeSyrup'){ //它这个不能去默认的
													ite.default_count = ites.min_number
												}else{
													ite.default_count = ites.default_count
												}
											}

										}
												ite.max_number = ites.max_number
												ite.min_number = ites.min_number
												obj.name = obj.group_name
												obj.extra_list.push(ite)
											}
										})
									})
									newarr.push(obj)
								}
							}
						})
					})
					//这里处理goods立马如果有匹配出来多余的浓缩分数 那就根据选的原萃浓缩来只展示一个
					// 找到第一个name为"浓缩份数"和萃取方式的对象的索引
					const index = arr.findIndex(item => item.name === "浓缩份数");

					if (index !== -1) {
					  // 从数组中移除除了第一个name为"浓缩份数"之外的所有对象
					  arr = arr.filter((item, i) => i === index || item.name !== "浓缩份数");
					}
					const index2 = arr.findIndex(item => item.name === "萃取方式");
					if (index !== -1) {
					  arr = arr.filter((item, i) => i === index2 || item.name !== "萃取方式");
					}
					// 检查是否存在 name 为 萃取方式 的对象
					let hasNameFive = arr.some(item => item.name === '萃取方式');

					if (!hasNameFive) {
					    // 过滤掉 name 为 浓缩份数 的对象
					    arr = arr.filter(item => item.name !== '浓缩份数');
					}
					let code = ""
					arr.forEach((items) => {
						if(items.name == '萃取方式'){
							items.checklist.forEach((it) => {
								if(it.text == items.checkbox){
									code = it.code
								}
							})
						}
					})
					newarr.forEach((item) => {
						if(item.group_code == code){
							arr.forEach((items) => {
								if(items.name == '浓缩份数'){
									items.code = code
									items.checklist[0].code = item.extra_list[0].code
									items.checklist[0].is_default = item.extra_list[0].is_default
									items.checklist[0].free_number = item.extra_list[0].free_number
									items.checklist[0].max_number = item.extra_list[0].max_number
									items.checklist[0].min_number = item.extra_list[0].min_number
									items.checklist[0].price = item.extra_list[0].price
								}
							})
						}
					})

					let obj = {
						goods: arr,
						goodarr:newarr,
						coffeelist: coffeelist,
						name: res.data.customization_data.name,
						id: res.data.customization_data.id,
						product_des: res.data.customization_data.product_des,
						price: price,
						amount: salePrice,
						oldprice: price,
						oldamount: salePrice,
						default_image: res.data.customization_data.default_image,
						rules: rules,
						quantity: 1,
						selcoffe: selcoffe,
						sku_id: sku_id,
						customizations: newcustomizations,

					}
					data.payfalg = false
					data.detail = obj
					popup.value.open()
					console.log(data.detail ,"data.detail ")
				} else {
					uni.showToast({
						icon: 'none',
						title: res.errmsg
					})
				}

			}
		})
	}

	//加入购物车
	function addcard() {

		data.detail.quantity = data.number
		data.detail.newprice= data.detail.price
		data.detail.newamount= data.detail.amount
		data.paylist.push(data.detail)
		data.cardtatal = data.paylist.length

		let money = 0
		let zkfc = 0
		let amount = 0
		data.paylist.forEach((it) => {
			money += parseFloat(it.price)
			amount += parseFloat(it.amount)
			zkfc += parseFloat(it.price - it.amount)
		})
		data.tatolmoney = (money + parseFloat(data.deliveryPrice)).toFixed(2)
		data.tatolamount = amount.toFixed(2)
		data.zkfc = zkfc.toFixed(2)

		data.payfalg = true
		popup.value.close()


	}
	//查看购物车
	function lookcard() {
		cardlist.value.open()
	}
	//减去
	function minus(row, i) {

		if (data.paylist[i].quantity == 1) {
			data.paylist.splice(i, 1)
			let money = 0
			let zkfc = 0
			let amount = 0
			data.paylist.forEach((it) => {
				money += parseFloat(it.price)
				amount += parseFloat(it.amount)
				zkfc += parseFloat(it.price - it.amount)
			})
			data.tatolmoney = (money + parseFloat(data.deliveryPrice)).toFixed(2)
			data.tatolamount = amount.toFixed(2)
			data.zkfc = zkfc.toFixed(2)
			cardlist.value.close()
		} else {
			data.paylist[i].quantity--
			data.paylist[i].amount = (data.paylist[i].newamount * data.paylist[i].quantity).toFixed(2)
			data.paylist[i].price = (data.paylist[i].newprice * data.paylist[i].quantity).toFixed(2)
			let money = 0
			let zkfc = 0
			let amount = 0
			data.paylist.forEach((it) => {
				money += parseFloat(it.price)
				amount += parseFloat(it.amount)
				zkfc += parseFloat(it.price - it.amount)
			})
			data.tatolmoney = (money + parseFloat(data.deliveryPrice)).toFixed(2)
			data.tatolamount = amount.toFixed(2)
			data.zkfc = zkfc.toFixed(2)
		}
		data.cardtatal = data.paylist.length
		if (data.paylist.length == 0) {
			cardlist.value.close()
		}
	}
	//增加
	function addpaylist(row, i) {

		data.paylist[i].quantity++
		data.paylist[i].amount = (data.paylist[i].newamount * data.paylist[i].quantity).toFixed(2)
		data.paylist[i].price = (data.paylist[i].newprice * data.paylist[i].quantity).toFixed(2)
		let money = 0
		let zkfc = 0
		let amount = 0
		data.paylist.forEach((it) => {
			money += parseFloat(it.price)
			amount += parseFloat(it.amount)
			zkfc += parseFloat(it.price - it.amount)
		})
		data.tatolmoney = (money + parseFloat(data.deliveryPrice)).toFixed(2)
		data.tatolamount = amount.toFixed(2)
		data.zkfc = zkfc.toFixed(2)
	}

	function getGoods() {
		proxy.$request({
			url: `api/openapi/starbucks/menuList/`,
			method: 'post',
			data: {
				lat: data.lat,
				lng: data.lng,
				store_code: data.store_code,
				order_type: data.order_type
			},
			success: (res) => {
				if (res.errno == 0) {
					data.title = res.data.name
					data.address = res.data.address
					data.deliveryPrice = res.data.deliveryPrice
					data.store_code = res.data.storeId
					res.data.categories.forEach((it) => {
						if (it.sub_categories.length > 0) {
							it.sub_categories.forEach((item) => {
								if (item.products.length > 0) {
									data.shoplist.push(item)
								}

							})
						}
					})
					data.list = res.data.categories[0].sub_categories[0].products

				} else {
					uni.showToast({
						icon: 'none',
						title: res.errmsg
					})
					data.title = ""
					data.address = ""
					data.store_code = ""
					data.deliveryPrice = ""
					data.lat = ""
					data.lng = ""
					data.shoplist = []
					data.list = []

				}
			}
		})
	}
	//左边类
	function changeNav(row, i) {
		data.active = i
		data.list = row.products
	}
	//查看地图
	function lookmap() {
		uni.openLocation({
			latitude: data.lat,
			longitude: data.lng,
			success: function() {
				console.log('success');
			}
		});
	}
	//减去
	function delextra(row, index, i) {
		data.number = 1
		let obj = data.detail.goods[index]
		let total = 0
		data.detail.goods[index].extra_list.forEach((it) => {
			total += it.is_default
		})
		if (total <= obj.group_min_number) {
			return
		} else {
			if (row.is_default <= row.min_number) {
				return
			} else {
				row.is_default--
				//这里得加所有的
				data.detail.price = data.detail.oldprice
				data.detail.amount = data.detail.oldamount
				let price = 0
				let amount = 0
				data.detail.goods.forEach((item) => {
					if(item.display_type == 'bar'){
						item.extra_list.forEach((ite) => {
						if(ite.name== '浓缩份数'){
							if ((ite.is_default - ite.default_count) > ite.free_number) {
								let num = (ite.is_default - ite.default_count) - ite.free_number
								if(num>0){
									price += num * ite.price
									amount += num * ite.price
								}
								console.log(num,ite.name,ite.price)
							}
						}else{
							if(item.code == 'ChangeSyrup' || item.name == '添加或更换风味糖浆'  ){
								let num  = 0
								if(ite.default_count>0 ){
										num =  ite.price_times[ite.is_default]>ite.default_count?ite.price_times[ite.is_default]:0  //这里只是测试他这个价格换算
								}else{
									num =  ite.price_times[ite.is_default]
								}
								if(num>0){
									price += num * ite.price
									amount += num * ite.price
								}
							}else if(item.code == 'Other'){
									let num  = 0
								if(ite.display_type == 'number'){
									if(ite.default_count>0 ){
											num =  ite.price_times[ite.is_default]>ite.default_count?ite.price_times[ite.is_default]:0  //这里只是测试他这个价格换算
									}else{
										num =  ite.price_times[ite.is_default]
									}
								}else{
									num =  ite.price_times[ite.is_default]
								}
								if(num>0){
									price += num * ite.price
									amount += num * ite.price
								}
							} else{
								let num  = 0
								num =  ite.price_times[ite.is_default]

								if(num>0){
									price += num * ite.price
									amount += num * ite.price
								}
							}
						}
						})
					}
				})
		data.detail.price=  ((parseFloat(data.detail.price) +  price +( data.detail.leachmeny || 0))).toFixed(2)
				data.detail.amount= ((parseFloat(data.detail.amount) + amount + ( data.detail.leachmeny || 0))).toFixed(2)
			}
		}
	}
	//添加
	function addextra(row, index, i) {
		data.number = 1
		let obj = data.detail.goods[index]
		let total = 0
		data.detail.goods[index].extra_list.forEach((it) => {
			total += it.is_default
		})
			let max_number = 0 //最大分数
			 //浓缩分数不按照这个
			if(obj.name !=='浓缩份数'){
				max_number  = obj.group_max_number
			}else{
			 max_number  =	obj.extra_list[0].max_number
			}
		if (total >= max_number ) {
			return
		} else {
			if (row.is_default >= row.max_number) {
				return
			} else {
				row.is_default++
				//这里得加所有的
				data.detail.price = data.detail.oldprice
				data.detail.amount = data.detail.oldamount
				let price = 0
				let amount = 0
				console.log(data.detail,"data.detail.goods")
				data.detail.goods.forEach((item) => {
					if(item.display_type == 'bar'){
						item.extra_list.forEach((ite) => {
							if(ite.name== '浓缩份数'){
								if ((ite.is_default - ite.default_count) > ite.free_number) {
									let num = (ite.is_default - ite.default_count) - ite.free_number
									if(num>0){
										price += num * ite.price
										amount += num * ite.price
									}
									console.log(num,ite.name,ite.price)
								}
							}else{
								if(item.code == 'ChangeSyrup' || item.name == '添加或更换风味糖浆'  ){
									let num  = 0
									if(ite.default_count>0 ){
											num =  ite.price_times[ite.is_default]>ite.default_count?ite.price_times[ite.is_default]:0  //这里只是测试他这个价格换算
									}else{
										num =  ite.price_times[ite.is_default]
									}
									if(num>0){
										price += num * ite.price
										amount += num * ite.price
									}
								}else if(item.code == 'Other'){
										let num  = 0
									if(ite.display_type == 'number'){
										if(ite.default_count>0 ){
												num =  ite.price_times[ite.is_default]>ite.default_count?ite.price_times[ite.is_default]:0  //这里只是测试他这个价格换算
										}else{
											num =  ite.price_times[ite.is_default]
										}
									}else{
										num =  ite.price_times[ite.is_default]
									}
									if(num>0){
										price += num * ite.price
										amount += num * ite.price
									}
								} else{
									let num  = 0
									num =  ite.price_times[ite.is_default]

									if(num>0){
										price += num * ite.price
										amount += num * ite.price
									}
								}
							}

						})
					}
				})
				data.detail.price=  ((parseFloat(data.detail.price) +  price +( data.detail.leachmeny || 0))).toFixed(2)
				data.detail.amount= ((parseFloat(data.detail.amount) + amount + ( data.detail.leachmeny || 0))).toFixed(2)

			}
		}
	}
</script>


<style scoped lang="scss">
	.container {
		background-color: #fff;

		.header {
			background-color: #fff;
			padding: 30upx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			background-image: url('https://img.fubaozx.cn/static/oldImg/1699501708457.png');
			background-repeat: no-repeat;
			background-size: 100% 10upx;
			background-position: bottom;

			.left {
				.address {
					font-size: 28upx;
					color: #333333;
				}

				.addressxx {
					font-size: 32upx;
					color: #333333;
					font-weight: bold;
					margin: 10upx 0;
				}

				.info {
					font-size: 24upx;
					color: #333333;
				}
			}
		}

		.position {

			height: 99px;
			display: flex;
			justify-content: space-between;
			align-items: center;
			background: url('https://pili-vod.guanxikeji.com/hemashangcheng/img/1730881665512.png') no-repeat 100% 100%;
			padding: 0 0px 0 22px;

			.position-text {
				width: 100%;
				padding-top: 11px;
				display: flex;
				justify-content: space-between;

				.left {
					width: 80%;
					font-size: 17px;
					font-family: PingFangSC-Medium, PingFang SC;
					font-weight: 500;
					color: rgba(0, 0, 0, .85);
					text-overflow: ellipsis;
					overflow: hidden;
					white-space: nowrap;

					.botm {

						font-size: 13px !important;
						font-family: PingFang-SC-Medium, PingFang-SC;
						font-weight: 500;
						color: rgba(0, 0, 0, .45);
						margin-top: 11px;
						display: flex;
						justify-content: space-between;
						align-items: center;

						.lefts {
							text-overflow: ellipsis;
							overflow: hidden;
							white-space: nowrap;
						}


					}
				}

				.right {
					width: 20%;

					image {
						bottom: 0;
						width: 77px;
						height: 77px;
						background-size: cover;
					}

				}
			}
		}

		.box {
			display: flex;
			justify-content: space-between;

			.itemize {
				width: 30%;

				.bg {
					background: #F7F8F9;

					.itemize-item {
						width: 110px;
						height: 77px;
						background: #f9f9f9;
						display: flex;
						flex-direction: column;
						justify-content: center;
						align-items: center;
						font-size: 13px;
						font-family: PingFang-SC-Medium, PingFang-SC;
						font-weight: 500;
						color: rgba(0, 0, 0, .45);
						line-height: 18px;

						.itemize-img-box {
							position: relative;

							.itemize-img-wrap {
								display: flex;
								justify-content: center;
								position: relative;

								image {
									width: 26px;
									height: 26px;
								}

								text {}
							}
						}
					}

					.ac {
						border-left: 4px solid rgb(3, 135, 62);
					}
				}

			}

			.right-goods {
				width: 70%;
				height: calc(100vh - 99px);
				background: #fff;

				.goods {

					padding-left: 11px;
					display: flex;
					justify-content: flex-start;
					align-items: center;
					margin-bottom: 22px;

					.goods-img {
						width: 40%;
						height: 110px;

					}

					.goods-info {
						width: 60%;
						flex: 1;
						height: 110px;
						margin-left: 5px;

						.goods-info-title {
							text-overflow: ellipsis;
							overflow: hidden;
							white-space: nowrap;
							font-size: 17px;
							font-family: PingFangSC-Medium, PingFang SC;
							font-weight: 500;
							color: rgba(0, 0, 0, .85);
						}

						.goods-info-price {
							height: 30px;
							font-size: 22px;
							font-family: AlibabaPuHuiTiB;
							color: rgba(0, 0, 0, .85);
							line-height: 30px;
							margin-top: 5px;
							display: flex;
							align-items: center;


						}

						.goods-info-btn-save {

							background: #fff;

							font-size: 11px;
							font-family: PingFangSC-Medium, PingFang SC;
							font-weight: 500;
							color: #fc2326;

						}

						.goods-info-price::before {
							content: "￥";
							font-size: 13px;
							font-family: AlibabaPuHuiTiB;
							color: rgba(0, 0, 0, .85);
						}

						.Al_Bold {
							font-family: webfont !important;
							font-style: normal;
							-webkit-font-smoothing: antialiased;
							-moz-osx-font-smoothing: grayscale;
						}

						.goods-info-btn {
							display: flex;
							justify-content: space-between;
							align-items: flex-end;
							min-height: 40px;
							padding-right: 20px;
							text-align: center;

							.goods-info-btn-other {}

							.goods-info-btn-select {
								width: 70px;
								height: 35px;
								background: rgb(3, 135, 62);
								border-radius: 17px;
								font-size: 15px;
								font-family: PingFang-SC-Heavy, PingFang-SC;
								font-weight: 800;
								color: #fff;
								line-height: 35px;
								text-align: center;
							}
						}
					}
				}
			}
		}
	}

	.product-bpx {
		border-radius: 22px 22px 0px 0px;
		width: 100%;
		padding: 22px 0 0;
		background-color: #fff;

		.product-info {
			padding: 0 22px;
			border-bottom: 0.5px solid #f2f2f2;

			.info-name {
				display: flex;
				align-items: center;
				justify-content: space-between;

				.name {
					font-size: 20px;
					font-family: PingFang SC-Semibold, PingFang SC;
					font-weight: 600;
					color: rgba(0, 0, 0, .85);
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-line-clamp: 1;
					-webkit-box-orient: vertical;
				}

				.number {
					display: flex;
					align-items: center;
					justify-content: center;
					font-size: 13px;
					color: rgba(0, 0, 0, .85);

					.delete {
						margin-right: 11px;
						width: 17px;
						height: 17px;
						background-repeat: no-repeat;
						background-size: cover;
						background-image: url('https://pili-vod.guanxikeji.com/hemashangcheng/img/1730966193871.png');
					}

					.add {
						margin-left: 11px;
						width: 17px;
						height: 17px;
						background-repeat: no-repeat;
						background-size: cover;
						background-image: url('https://pili-vod.guanxikeji.com/hemashangcheng/img/1730966186417.png');
					}
				}


				.Al_Medium {
					font-family: Medium !important;
					font-style: normal;
					-webkit-font-smoothing: antialiased;
					-moz-osx-font-smoothing: grayscale;
				}

			}

			.info-tips {
				margin-top: 11px;
				font-size: 12px;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: rgba(0, 0, 0, .85);
				margin-bottom: 16px;

				text {
					color: rgba(0, 0, 0, .45);
					margin: 2px;
				}
			}
		}

		.sku-box {
			margin-top: 27px;
			padding: 0 22px;

			.sku-wrap {
				margin-top: 8px;

				.sku-title {
					color: rgba(0, 0, 0, .85);
					font-size: 14px;
					font-weight: 500;
				}

				.sku-list {
					margin: 22px 0;
					display: flex;
					flex-wrap: wrap;

					.sku {
						width: 117px;
						margin-right: 11px;
						margin-bottom: 11px;
						font-size: 14px;
						color: rgba(0, 0, 0, .85);
						font-weight: 500;
						text-align: center;
						border: 0.5px solid transparent;
						border-radius: 5px;
						padding: 5px;
						box-sizing: border-box;

						.sku-img-box {
							position: relative;

							.sku-img-icon {
								width: 24px;
								height: 24px;
								box-sizing: border-box;
								border: 2px solid rgba(0, 0, 0, .25);
								border-radius: 100%;
								position: absolute;
								right: 0;
								top: 0;
								z-index: 20;

							}

							.sku-img {
								width: 107px;
								height: 107px;
							}
						}
					}

					.br {
						border-color: rgb(191, 191, 191);
					}

					.img-none {
						height: 38px !important;
						line-height: 27px;
					}
				}
			}

			.other-sku-box {
				color: rgba(0, 0, 0, .85);
				font-size: 14px;

				.other-sku-wrap {
					margin-top: 15px;

					.other-sku-title {
						color: rgba(0, 0, 0, .45);
						font-size: 13px;

						.other-sku-list {
							margin-top: 7px;
							display: flex;
							align-items: center;
						}
					}
				}
			}

			.illustrate-box {
				margin-top: 27px;
				padding-bottom: 35px;

				.illustrate-title {
					font-size: 15px;
					color: rgba(0, 0, 0, .45);
				}

				.illustrate {
					margin-top: 11px;
					font-size: 15px;
					color: rgba(0, 0, 0, .45);
				}
			}

		}


		.product-bth-box {


			background-color: #fff;
			padding: 8px 22px 20px 22px;
			box-shadow: 0 -5px 16px 0 hsla(0, 0%, 94.9%, .6);

			.product-bth {

				height: 48px;
				background-color: rgb(3, 135, 62);
				border-radius: 33px;
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding: 0 16px;

				.product-price {
					display: flex;
					align-items: center;

					.after-price {
						font-size: 13px;
						color: #fff;
						font-family: AlibabaPuHuiTiM;

						text {
							font-size: 22px;
							margin-left: 2px;
						}
					}

					.before-price {
						font-size: 13px;
						color: #fff;
						font-family: AlibabaPuHuiTiM;
						margin-left: 7px;
					}
				}

				.btn-text {
					font-size: 19px;
					color: #fff;
				}
			}
		}


	}

	.Shopping-Cart {
		border-radius: 22px 22px 0px 0px;
		height: 518px;
		padding: 16px 16px 0;
		background-color: #fff;

		.cart-head {
			text-align: right;
			color: rgba(0, 0, 0, .85);
			font-size: 13px;
			margin-bottom: 11px;
			display: flex;
			justify-content: flex-end;

			image {
				width: 17px;
				height: 17px;
				margin-right: 5px;
			}
		}

		.cart-item-wrap {
			width: 100%;
			display: flex;
			flex-wrap: wrap;

			.cart-item {
				width: 100%;
				display: flex;
				padding-bottom: 11px;
				border-bottom: 0.5px solid #f2f2f2;
				margin-bottom: 16px;

				image {
					max-width: 77px;
					min-width: 77px;
					height: 77px;
				}

				.cart-item-box {
					flex-grow: 1;
					margin-left: 11px;

					.item-box-title {
						font-size: 17px;
						font-weight: 500;
						font-family: PingFang-SC-Medium, PingFang-SC;
						color: rgba(0, 0, 0, .85);
						overflow: hidden;
						text-overflow: ellipsis;
						display: -webkit-box;
						-webkit-line-clamp: 1;
						-webkit-box-orient: vertical;
					}

					.item-box-tips-box {
						width: 100%;
						overflow: hidden;
						text-overflow: ellipsis;
						display: -webkit-box;
						-webkit-line-clamp: 1;
						-webkit-box-orient: vertical;

						.item-box-tips2 {
							font-size: 11px;
							color: rgba(0, 0, 0, .45);
							font-family: PingFang-SC-Medium, PingFang-SC;
							font-weight: 400;
							display: inline-block;
						}
					}

					.item-box-bottom {
						width: 100%;
						display: flex;
						justify-content: space-between;
						// margin-top: 8px;

						.price {
							font-size: 22px;
							font-weight: 400;
							color: rgba(0, 0, 0, .85);

							text {
								font-size: 13px;
								font-weight: 700;
							}

							.Al_Medium {
								font-size: 13px;
								color: red;
								// margin-left: 5px;
								font-weight: 500;
								margin-right: 5px;
								// text-decoration: line-through;
							}

						}

						.number {
							display: flex;
							align-items: center;
							justify-content: center;
							font-size: 13px;
							color: rgba(0, 0, 0, .85);

							.add {
								margin-right: 11px;
								width: 17px;
								height: 17px;
								background-repeat: no-repeat;
								background-size: cover;
								background-image: url('https://pili-vod.guanxikeji.com/hemashangcheng/img/1730966193871.png');
							}

							.delete {
								margin-left: 11px;
								width: 17px;
								height: 17px;
								background-repeat: no-repeat;
								background-size: cover;
								background-image: url('https://pili-vod.guanxikeji.com/hemashangcheng/img/1730966186417.png');
							}
						}
					}
				}
			}
		}
	}

	.bootm {
		width: 100%;
		display: flex;
		justify-content: space-between;
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 10003;

		.fixed-menu {
			width: 100%;
			height: 66px;
			background: #fff;
			box-shadow: 0px -5px 16px 0px hsla(0, 0%, 94.9%, .8);
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding-left: 10px;

			.fixed-menu-price {
				flex: 1;
				display: flex;
				justify-content: flex-start;

				.fixed-menu-price-img {
					width: 77px;
					height: 66px;
					position: relative;

					image {
						width: 77px;
						height: 77px;
						position: absolute;
						top: -11px;
					}
				}

				.fixed-menu-money {
					flex: 1;
					height: 66px;
					padding-top: 6px;
					margin-left: 11px;

					.Al_Bold {
						font-family: webfont !important;
						font-style: normal;
						-webkit-font-smoothing: antialiased;
						-moz-osx-font-smoothing: grayscale;
						display: flex;
						align-items: center;

						.fixed-menu-money-font1 {
							font-size: 22px;
							font-family: AlibabaPuHuiTiB;
							color: rgba(0, 0, 0, .85);

							text {
								font-size: 13px;
								font-family: AlibabaPuHuiTiM;
								color: rgba(0, 0, 0, .25);
								text-decoration: line-through;
								margin-left: 5px;
							}
						}
					}

					.other-tips {
						display: inline-flex;
						height: 17px;
						background: #fff;
						border-radius: 2px;
						font-size: 11px;
						font-family: PingFangSC-Medium, PingFang SC;
						font-weight: 500;
						color: #fc2326;
						line-height: 16px;
						padding: 0 5px;
						border: 0.5px solid #fc2326;
						border-color: rgb(209, 33, 40);
						color: rgb(209, 33, 40);
					}

					.fixed-menu-money-font1::before {
						content: "￥";
						font-size: 13px;
						color: rgba(0, 0, 0, .85);
					}
				}


			}

			.fixed-menu-pay {
				width: 120px;
				height: 66px;
				background: rgb(3, 135, 62);
				font-size: 19px;
				font-family: PingFang-SC-Heavy, PingFang-SC;
				font-weight: 800;
				color: #fff;
				line-height: 66px;
				text-align: center;
			}
		}
	}

	::v-deep .uni-badge--error {
		background-color: #03873e;
	}

	::v-deep .uni-data-checklist .checklist-group .checklist-box.is--tag.is-checked {
		background-color: #03873e;
		border-color: #03873e;
	}

	.item_extra {
		margin: 8px 1px 0 1px;
		border-radius: 4px;
		padding: 8px 15px 7px;
		box-sizing: border-box;
		background: rgb(3, 135, 62);

		.allcenter {
			display: flex;
			justify-content: center;
			align-items: center;

			image {
				width: 16px;
				height: 16px;
			}
		}
	}

	.mingInfo {
		font-size: 10px;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #999;
		display: flex;
		padding-top: 5px;

		.paybtnInfo-icon-up {
			width: 16px;
			height: 16px;
			background-image: url(https://pili-vod.guanxikeji.com/logo/img/1731116006296.png);
			background-size: cover;
		}
	}
</style>
